

class UserResponseModel {
  final int code;
  final UserData data;

  UserResponseModel({required this.code, required this.data});
  factory UserResponseModel.init() => UserResponseModel(
        code: 400,
        data: UserData.init(),
      );

  factory UserResponseModel.fromJson(Map<String, dynamic> json) =>
      UserResponseModel(
          code: json['code'] ?? 400,
          data: json['data'] == null ? UserData.init() : UserData.fromJson(json['data']));
}

class UserData {
  final int id;
  final String uid;
  final String nickName;
  final int isRealName;
  final String avatarUrl;
  final String code;
  final int googleStatus;
  final String account;
  final String username;
  final String unit;

  UserData(
      {required this.id,
      required this.uid,
      required this.nickName,
      required this.isRealName,
      required this.avatarUrl,
      required this.code,
      required this.googleStatus,
      required this.account,
      required this.username,
      required this.unit});

  factory UserData.init() => UserData(
      id: 0,
      uid: '',
      nickName: '',
      isRealName: 0,
      avatarUrl: '',
      code: '',
      googleStatus: 0,
      account: '',
      username: '',
      unit: '');

  factory UserData.fromJson(Map<String, dynamic> json) => UserData(
        id: json['id'] ?? 0,
        uid: json['uid'] ?? '',
        nickName: json['nick_name'] ?? '',
        isRealName: json['is_real_name'] ?? 0,
        avatarUrl: json['avatar_url'] ?? '',
        code: json['code'] ?? '',
        googleStatus: json['google_status'] ?? 0,
        account: json['account'] ?? '',
        username: json['username'] ?? '',
        unit: json['unit'] ?? '',
      );
}
